<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/

/*
 * DEVNOTE: This is the 'main' file. 
 * It's the one that will be called when we go to the JobBoard component. 
 */
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

/*
 * Make sure the user is authorized to view this page
 */
if (! class_exists ( 'JAStack' )&&! class_exists ( 'SmartTrim' ))
	require_once(JPATH_COMPONENT_SITE.DS.'helper'.DS.'jahelper.php');
require_once JPATH_COMPONENT_SITE.DS.'asset'.DS.'jaconstants.php';
require_once (JPATH_COMPONENT_SITE.DS.'asset'.DS.'japermissions.php');
require_once (JPATH_COMPONENT_SITE.DS.'helper'.DS.'jafunctions.class.php');
define('JA-ADMINISTRATOR', true);
component_configs();

require_once(JPATH_COMPONENT_SITE.DS.'asset'.DS.'jacache'.DS.'jacache.php');
require_once(JPATH_COMPONENT_SITE.DS.'asset'.DS.'jacache'.DS.'jajob.inc.php');

// Require the base controller
require_once (JPATH_COMPONENT.DS.'controller.php');

// Require the submenu for component
require_once (JPATH_COMPONENT.DS.'views'.DS.'jaview'.DS.'view.html.php');

// Require specific controller if requested
if($controller = JRequest::getCmd('view', 'jajobboard')) {
	$path = JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php';
	if (file_exists($path)) {
		require_once $path;
	} else {
		$controller = '';
	}
}

$view = $controller;

// Create the controller
$classname	= 'JAJobBoardController'.ucfirst($controller);
$controller	= new $classname( );

/* Clean cache*/

$task = JRequest::getVar('task', null, 'default', 'cmd');

$cache = new JA_Cache();
$cache->clean_cache($view, $task, $admin_clean_config);

// Perform the Request task
$controller->execute( $task);

// Redirect if set by the controller
$controller->redirect();